import * as React from "react";
import { useRouteMatch, Route, Switch } from "react-router-dom";
import Hello from "@src/pages/Hello";
import NotFound from "@src/pages/NotFound";
import LoadingPage from "@src/pages/LoadingPage";

const { Suspense } = React;
function Routes() {
	const match = useRouteMatch();
	return (
		<Suspense fallback={<LoadingPage />}>
			<Switch>
				<Route exact path={`${match.url}`} component={Hello} />
				<Route path="*" component={NotFound} />
			</Switch>
		</Suspense>
	);
}

export default Routes;
